package com.itheima.controller;

import com.itheima.domain.Address;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import java.util.List;

/**
 * @Author 王加鑫
 * @Date 2021/07/26 14:37
 * @Since JDK 1.8
 */
@Controller
public class PostController {

    @RequestMapping("/post01")
    public String post01(@RequestBody String name){
        System.out.println("name:" + name);
        return "page.jsp";
    }

    @RequestMapping("/post02")
    public String post02(@RequestBody List<Address> addressList){
        System.out.println("addressList:" + addressList);
        return "page.jsp";
    }

    @RequestMapping("/post03")
    @ResponseBody
    public List post03(@RequestBody List<Address> addressList){
        System.out.println("addressList:" + addressList);
        return addressList;
    }
}
